package com.zbkj.crmeb.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.constants.Constants;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 支付方式
 * @author daigb
 * @date:  2022-07-26 10:26
 */
public enum PayTypeEnum implements IEnum<Integer> {

	/**
	 * 微信支付
	 */
	WEIXIN(1, Constants.PAY_TYPE_WE_CHAT),
	
	/**
	 * 橙子支付
	 */
    ORANGE(2, Constants.PAY_TYPE_ORAGE_PAY),
    
    /**
     * 香港支付
     */
    HK_PAY_ALIGOGO(3, Constants.PAY_TYPE_HK_PAY), // aligogo 独有支付
    
    /**
     * 汇付聚合支付
     */
    ADAPAY_DEGREE(4, Constants.PAY_TYPE_ADAPAY_DEGREE),
    
    /**
     * 汇付国内支付
     */
    ADAPAY_CN(5, Constants.PAY_TYPE_ADAPAY_CN),

    /**
     * 连连聚合支付
     */
    LIANLIAN_DEGREE(6, Constants.PAY_TYPE_LIANLIAN_DEGREE),

    ;

    private final Integer code;
    private final String msg;

    PayTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static PayTypeEnum valueOf(Integer code) {
        for (PayTypeEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return PayTypeEnum.WEIXIN;
    }

    @Override
    @JsonValue
    public Integer getValue() {
        return code;
    }

}

